package com.platform.api.film.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.platform.api.film.model.FilmPlayRecord;
import com.platform.api.film.service.FilmPlayRecordService;
import com.platform.common.core.Result;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;


/**
 * 用户播放记录
 * @author guoshao
 * @email 2549789059@qq.com
 * @date 2023-09-09 11:08:06
 */

@RestController
@RequestMapping("{appid}/film/playRecord")
public class FilmPlayRecordController {

    @Autowired
    private FilmPlayRecordService filmPlayRecordService;

    /**
     * 获取播放记录
     * @return
     */
    @GetMapping("u/getPlayRecord/{filmId}")
    public Result getPlayRecord(@PathVariable Long filmId){
        return Result.success(filmPlayRecordService.getPlayIds(filmId));
    }

    @PostMapping("u/addOrUpdate/{resourceId}")
    public Result addOrUpdate(@PathVariable Long resourceId){
        //添加播放-解锁记录
        return Result.bool(filmPlayRecordService.addOrUpdate(resourceId));
    }

    @GetMapping("u/filmPlayRecordPage")
    public Result getDetail(Page page)  {
        return Result.success(filmPlayRecordService.filmPlayRecordPage(page));
    }

}
